package adv329;

import java.util.Arrays;
import java.util.Random;

/**
 * @author oldliu
 * @since 1.0
 */
public class RanomTest {
    public static void main(String[] args) {
        //Math.random
        Random r=new Random();
        System.out.println("int");
        for (int i = 0; i < 20; i++) {
            System.out.print(r.nextInt()+" ");
        }
        System.out.println();
        System.out.println("int,限制范围，0---指定的范围");//含头不含尾
        for (int i = 0; i < 20; i++) {
            System.out.print(r.nextInt(200)+" ");
        }
        System.out.println();

        System.out.println("float");//含头不含尾
        for (int i = 0; i < 20; i++) {
            System.out.print(r.nextFloat()+" ");
        }
        System.out.println();
        System.out.println("double");
        for (int i = 0; i < 20; i++) {
            System.out.print(r.nextGaussian()+" ");
        }
        System.out.println();
        System.out.println("boolean");
        for (int i = 0; i < 20; i++) {
            System.out.print(r.nextBoolean()+" ");
        }
        System.out.println();
        System.out.println("byte");
        byte b[]=new byte[20];
        for (int i = 0; i < 20; i++) {
            r.nextBytes(b);
            System.out.println(Arrays.toString(b));
        }
    }
}
